//
//  PurchaseSearchListViewModel.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/10.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "PurchaseSearchListViewModel.h"
#import "HomeHotPictureTableViewCell.h"
#import "HomeHotOrderTableViewCell.h"
#import "StoreTopSelectView.h"

@interface PurchaseSearchListViewModel ()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation PurchaseSearchListViewModel

-(instancetype)initWithViewToViewModel:(UITableView *)tableView theSuperView:(UIView *)superView{
    if (self = [super initWithViewToViewModel:tableView theSuperView:superView]) {
        tableView.y = tableView.y + kHeightProportion_In_iPhoneTriploid(34);
        tableView.height = tableView.height - kHeightProportion_In_iPhoneTriploid(78);
        tableView.mj_header.hidden = YES;
        tableView.mj_footer.hidden = YES;
        tableView.delegate = self;
        tableView.dataSource = self;
        tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeightProportion_In_iPhoneTriploid(10))];
        [superView addSubview:tableView];
        //
        StoreTopSelectView * purTopView = [[StoreTopSelectView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeightProportion_In_iPhoneTriploid(34)) inSuperView:superView];
    }
    return self;
}

#pragma mark -- UITableViewDelegate,UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 5;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        return kHeightProportion_In_iPhoneTriploid(163);
    }else{
        return kHeightProportion_In_iPhoneTriploid(190);
    }
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    BaseTableViewCell * cell;
    if (indexPath.row == 0) {
        HomeHotOrderTableViewCell * cell_order = [HomeHotOrderTableViewCell cellWithTableView:tableView];
        cell = cell_order;
    }else{
        HomeHotPictureTableViewCell * cell_picture = [HomeHotPictureTableViewCell cellWithTableView:tableView];
        cell = cell_picture;
    }
    return cell;
}

@end
